perm filename TENEXI.SAI[PIC,HE] blob sn#428030 filedate 1979-03-25 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	Simulate tenex io routines with sail subroutines and macros
C00006 ENDMK
C⊗;
COMMENT Simulate tenex io routines with sail subroutines and macros;


procedure swdptr(integer chan,wordno);
begin
	integer i,temp;
	useti(chan,wordno/'200+1);
	useto(chan,wordno/'200+1);
	for i←0 step 1 while i< ('177 land wordno) do
		wordin(chan);
end;




integer procedure openfile(string name,options);
begin
	integer chan,rwmode,i,insize,outsize;
	integer count,brchar,eof,flag;
	comment Should do something to look at option flags of "options";
	rwmode←0;
	for i←1 step 1 until length(options) do begin
		if equ(options[i for 1],"r") then rwmode← rwmode lor 1;
    		if equ(options[i for 1],"R") then rwmode← rwmode lor 1;
 		if equ(options[i for 1],"w") then rwmode← rwmode lor 2;
 		if equ(options[i for 1],"W") then rwmode← rwmode lor 2;
 		if equ(options[i for 1],"a") then rwmode← rwmode lor 4;
 		if equ(options[i for 1],"A") then rwmode← rwmode lor 4;
	end;
	comment other options have to do with tenex version numbers,file access
	        and hence are not implemented;

	comment If name is null, ask user for filename;
	if length(name)=0 then begin
		print('15 & '12 &"filename? ");
		name← inchwl;
	end;

	chan←getchan;
	if (rwmode land 5) > 0 then insize ←4 else insize ←1;
	if (rwmode land 6) > 0 then outsize ←4 else outsize ←1;
	open(chan,"DSK",'10,insize,outsize,count,brchar,eof);
	if (rwmode land 5) > 0 then lookup(chan,name,flag);
	if (rwmode land 6) > 0 then enter(chan,name,flag);
	comment Set pointer to end of file if append;
	if (rwmode land 4) > 0 then call(chan,"ugetf");
	return(chan);
end;

boolean procedure cfile(integer chan);
begin
	release(chan);
	return(true);
end;

define intty = "inchwl";

define psout = "print";

define closf = "close";